package Study;

import java.util.Scanner;

public class Demo3 {
    /**
     * 冒泡
     */
    public static void main(String[] args) {

        int[] scores = new int[5];

        Scanner input = new Scanner (System.in);

        System.out.println ("请输入5个整型数字：");

        //赋值
        for (int i = 0; i < scores.length; i++) {

            scores[i] = input.nextInt ();

        }


        //冒泡排序
        for (int i = 0; i < scores.length-1; i++) {

            for (int j = 0; j < scores.length-i-1; j++) {

                if (scores[j]<scores[j+1]){
                    int temp = scores[j];
                    scores[j] = scores[j+1];
                    scores[j+1] = temp;
                }

            }

        }

        System.out.println ("降序排序为：");

        for (int score : scores) {

            System.out.print (score+"\t");

        }


    }
}
